package com.ducanh.doan.utils;

import com.ducanh.doan.R;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.view.View;

public class DialogUtils {
	
	public static Dialog showDialogWithOK(Context context, View v, String message, String ok) {
		AlertDialog.Builder builder = new Builder(context);
		builder.setMessage(message)
		.setNegativeButton(ok, new DialogInterface.OnClickListener() {
			
			@Override
			public void onClick(DialogInterface dialog, int which) {
				dialog.dismiss();
			}
		}).setView(v);
		return builder.create();
	}
	
	public static void showExitDialog(Activity activity) {
		AlertDialog.Builder builder = new Builder(activity);
		builder.setMessage(activity.getString(R.string.exit_app))
		.setNegativeButton(activity.getString(R.string.yes), new DialogInterface.OnClickListener() {
			
			@Override
			public void onClick(DialogInterface dialog, int which) {
				dialog.dismiss();
				System.exit(0);
			}
		}).setPositiveButton(activity.getString(R.string.no), new DialogInterface.OnClickListener() {
			
			@Override
			public void onClick(DialogInterface dialog, int which) {
				dialog.dismiss();
			}
		}).create().show();
	}
}
